package com.example.guarding_jc;

import java.nio.charset.Charset;

public class DBEntry {
	private String id;
	private String seq;
	private String challenge;
	private String mac;
	private String uid;
	private String time;
	private String imei;
	
	public DBEntry(){
		id = seq = challenge = mac = uid = time = imei = null;
	}
	
	public DBEntry(String id, String seq, String challenge, String mac, String uid, String time, String imei){
		this.id = id;
		this.seq = seq;
		this.challenge = challenge;
		this.mac = mac;
		this.uid = uid;
		this .uid = uid;
		this.imei = imei;
	}
	
	public String getImei() {
		return imei;
	}

	public void setImei(String imei) {
		this.imei = imei;
	}

	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getSeq() {
		return seq;
	}
	public void setSeq(String seq) {
		this.seq = seq;
	}
	public String getChallenge() {
		return challenge;
	}
	public void setChallenge(String challenge) {
		this.challenge = challenge;
	}
	public String getMac() {
		return mac;
	}
	public void setMac(String mac) {
		this.mac = mac;
	}
	public String getUid() {
		return uid;
	}
	public void setUid(String uid) {
		this.uid = uid;
	}
	public String getTime() {
		return time;
	}
	public void setTime(String time) {
		this.time = time;
	}
	
	public String toString(){
		//return id + "--" + seq + "--" + challenge + "--" + mac + "--" + uid + "--" + time + "--" + imei;
		String dbEntry = "";
		
		dbEntry += "HMAC = " + mac + "\n";
		dbEntry += "Challenge = " + challenge + "\n";
		dbEntry += "Sequence = " + seq + "\n";
		dbEntry += "UID = " + uid + "\n";
		dbEntry += "IMEI = " + new String(Utility.toByteArray(imei), Charset.forName("US-ASCII")) + "\n";
		dbEntry += "Time = " + new String(Utility.toByteArray(time), Charset.forName("US-ASCII")) + "\n";
		
		return dbEntry;
	}
	
}
